package com.sdyd.antivirus.utils;

/**
 * @author liujia
 * @date 2020/2/1 20:50
 **/
public class CurrentConditionArray {
    /**
     * 统计目前身体状况
     * @param source
     * @param target
     */
    public static void currentBodyConditon(String[] source, int target[]) {
        for (int i = 0; i < source.length; i++) {
            switch (source[i]) {
                case "1":
                    target[0]++;
                    break;
                case "2":
                    target[1]++;
                    break;
                case "3":
                    target[2]++;
                    break;
                case "4":
                    target[3]++;
                    break;
                case "5":
                    target[4]++;
                    break;
                case "6":
                    target[5]++;
                    break;
                default:break;
            }

        }
    }

    /**
     * 统计是否接触过武汉人员
     * @param source
     * @param target
     */
    public static void contactWhPeople(int source,int target[]){
        switch (source) {
            case 0:
                target[0]++;
                break;
            case 1:
                target[1]++;
                break;
            case 2:
                target[2]++;
                break;
            default:break;
        }
    }

    /**
     * 统计乘车工具
     * @param source
     * @param target
     */
    public static void vehicle(String[] source, int target[]){
        for (int i = 0; i < source.length; i++) {
            switch (source[i]) {
                case "0":
                    target[0]++;
                    break;
                case "1":
                    target[1]++;
                    break;
                case "2":
                    target[2]++;
                    break;
                case "3":
                    target[3]++;
                    break;
                case "4":
                    target[4]++;
                    break;
                case "5":
                    target[5]++;
                    break;
                case "6":
                    target[6]++;
                    break;
                case "7":
                    target[7]++;
                    break;
                default:break;
            }

        }
    }

    /**
     * 根据的身体状况的代码，返回对应文字
     * @param currentBodyCondition
     * @return
     */
    public static String formatUserInfo(String currentBodyCondition){
        String[] condition = currentBodyCondition.split(",");
       StringBuilder stringBuilder = new StringBuilder();
        for (int i = 0; i < condition.length; i++) {
            String split = "";
            if(i!=condition.length-1){
                split="、";
            }else{
                split = "";
            }
            switch (condition[i]) {
                case "1":
                    stringBuilder.append("正常"+split);
                    break;
                case "2":
                    stringBuilder.append("感冒"+split);
                    break;
                case "3":
                    stringBuilder.append("发烧"+split);
                    break;
                case "4":
                    stringBuilder.append("咳嗽"+split);
                    break;
                case "5":
                    stringBuilder.append("乏力"+split);
                    break;
                case "6":
                    stringBuilder.append("其他"+split);
                    break;
                default:break;
            }

        }
        return stringBuilder.toString();
    }

    /**
     * 返回人员类型
     * @param type
     * @return
     */
    public static String formatPeopleType(int type ){
        StringBuilder s = new StringBuilder();
        switch (type){
            case 1:
                s.append("在职") ;
                break;
            case 2:
                s.append("招聘") ;
                break;
            case 3:
                s.append("借调") ;
                break;
            case 4:
                s.append("帮助工作") ;
                break;
            case 5:
                s.append("驻场开发") ;
                break;
            case 6:
                s.append("服务") ;
                break;
            default:break;
        }
        return s.toString();
    }

    public static String formatVehicle(String Vehicle){
        String[] vehicle = Vehicle.split(",");
        StringBuilder stringBuilder = new StringBuilder();
        for (int i = 0; i < vehicle.length; i++) {
            String split = "";
            if(i!=vehicle.length-1){
                split="、";
            }else{
                split = "";
            }
            switch (vehicle[i]) {
                case "0":
                    stringBuilder.append("无"+split);
                    break;
                case "1":
                    stringBuilder.append("私家车"+split);
                    break;
                case "2":
                    stringBuilder.append("公交车"+split);
                    break;
                case "3":
                    stringBuilder.append("火车"+split);
                    break;
                case "4":
                    stringBuilder.append("地铁"+split);
                    break;
                case "5":
                    stringBuilder.append("飞机"+split);
                    break;
                case "6":
                    stringBuilder.append("轮渡"+split);
                    break;
                case "7":
                    stringBuilder.append("其他"+split);
                    break;
                default:break;
            }

        }
        return stringBuilder.toString();
    }
    public static void main(String[] args) {
        System.out.println(formatVehicle(""));
    }
}
